public class Singelton04 {

    private static Singelton04 singelton;

    private Singelton04() {
    }

    public static synchronized Singelton04 getInstance() {
        if (singelton == null) {
            singelton = new Singelton04();
        }
        return singelton;
    }

    public static void main(String[] args) {
        Singelton04 singelton1 = Singelton04.getInstance();
        Singelton04 singelton2 = Singelton04.getInstance();
        System.out.println(singelton1 == singelton2);
    }
}
